/* ***********************************************************************
 * 项目名称:油耗
 * 项目组:
 * 创建时间:2017.7.11
 * 创建人:马方印
 * 用途:自定义出油入油记录按钮
 * 版本:1.0
 * 修改记录:    修改内容   修改原因   修改人   修改时间
 *               无        无       无       无
 *************************************************************************/

#import "YZCustomRecordBtn.h"

@implementation YZCustomRecordBtn

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        [self setImage:[UIImage imageNamed:@"up_white1"] forState:UIControlStateNormal];
        [self setBackgroundImage:[UIImage imageNamed:@"bg_phone_title"] forState:UIControlStateNormal];
        [self setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
    }
    
    return self;
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect{
    
    CGFloat x = (contentRect.size.width - 80)/2;
    CGFloat y = 0;
    CGFloat w = 80;
    CGFloat h = contentRect.size.height;
    
    CGRect rect = CGRectMake(x, y, w, h);
    
    return rect;
}

//18 * 12
- (CGRect)imageRectForContentRect:(CGRect)contentRect{
    
    CGFloat x = (contentRect.size.width - 80)/2 + 80;
    CGFloat y = (contentRect.size.height - 12) / 2;
    CGFloat w = 18;
    CGFloat h = 12;
    
    CGRect rect = CGRectMake(x, y, w, h);
    
    return rect;
}

@end
